Repository navigation
Backport #4334: [core] When live stream read waits forever at missing chunk, fail early instead - #5521
Merged
Conversation
…ly instead (#4334) Addresses the reader-side part of #4306. It does not close the issue, because the chunk loss itself is not fixed here. When a chunk below a stream's known tail is missing from storage, every live-read session opened at that index ends without delivering a frame. `createReconnectingFramedStream` reconnects from the same index until its consecutive-reconnect budget (50) runs out. Each such session lasts the server's max response duration (~2 min), so a reader sits on the hole for well over an hour before it errors, with a generic "exceeded maximum reconnection attempts" message. When a session stays open for at least 10 seconds and ends (clean EOF or errored body) without receiving any bytes, the reader checks `streams.getInfo`. If the tail is at or past the resume index, the chunk is known to exist but was not served, so this isn't an idle wait for new data. After 3 consecutive stalls like this, the read fails with a `StreamError` that names the missing index and the tail, and says to resume from `startIndex` = index + 1. - Sessions that deliver data pay nothing extra: metadata is fetched only for zero-frame sessions, and on EOF it reuses the lookup completion verification already does. - An idle reader at the tail (tail < resume index) keeps waiting as before. So does a reader whose metadata lookup fails. - A session that received partial-frame bytes counts as progress, not a stall. A zero-byte session that ends within 10 seconds (a brief server blip) neither counts nor resets the stall streak, and is retried against the general reconnect budget as before. - The reader does not skip the hole on its own. Silently dropping a chunk (for example a UI message `start` part) can corrupt consumer state. Failing with the index lets the caller decide. This does not restore lost chunks. The storage-side loss reported in Co-authored-by: Peter Wielander <29887157+VaguelySerious@users.noreply.github.com> Co-authored-by: Peter Wielander <mittgfu@gmail.com> Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Contributor
🦋 Changeset detectedLatest commit: e5a9aff The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
VaguelySerious
approved these changes
Nov 17, 2026
VaguelySerious
enabled auto-merge (squash)
November 17, 2026 23:56
Contributor
Author
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (106 failed)redis (20 failed):
turso (86 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated backport of #4334 to
stable(backport job run).AI recommendation: This is a hang fix in existing functionality.
createReconnectingFramedStreamand its reconnect budget are already onstable, so a live read stuck at a missing chunk sits there for well over an hour before it fails with a generic error. The patch makes it fail after about three stalled sessions with aStreamErrorthat names the index, and it adds tests. It will not cherry-pick cleanly:stablecallsworld.getStreamInfo(name, runId)wheremaincallsworld.streams.getInfo(runId, name), so the conflicts need adapting.Merge conflicts were resolved by AI (opencode with
anthropic/claude-opus-5.5). Please review the conflict resolution carefully before merging.